package com.uw.scenic.exception;


import com.uw.scenic.common.ResponseStatusEnum;

/**
 * 自定义异常
 * 业务异常
 * 目的：统一处理异常信息
 *      便于解耦，service与controller错误的解耦，不会被service返回的类型而限制
 * @author  yls
 * @date 2022-04-01
 */
public class BusinessException extends RuntimeException {

    private ResponseStatusEnum responseStatusEnum;

    public BusinessException(ResponseStatusEnum responseStatusEnum) {
        super("异常状态码为：" + responseStatusEnum.status()
                + "；具体异常信息为：" + responseStatusEnum.msg());
        this.responseStatusEnum = responseStatusEnum;
    }

    public ResponseStatusEnum getResponseStatusEnum() {
        return responseStatusEnum;
    }

    public void setResponseStatusEnum(ResponseStatusEnum responseStatusEnum) {
        this.responseStatusEnum = responseStatusEnum;
    }
}